// app.js
import "utils/utils.js"
import './utils/http'
App({
  globalData: {},
  onLaunch() {
    this.gettoken();
    this.getrefreshToken()
  },
  // 获取token
  gettoken() {
    // 从本地存储中获取
    const token = wx.getStorageSync('token');
    // 存为app的全局变量
    this.token = token
    return token
  },
  // 获取refreshToken
  getrefreshToken() {
    // 从本地存储中获取
    const refreshToken = wx.getStorageSync('refreshToken');
    // 存为app的全局变量
    this.refreshToken = refreshToken
    return refreshToken
  },
  // 记录token和refreshToken
  settoken(token, refreshToken) {
    wx.setStorageSync('token', token)
    wx.setStorageSync('refreshToken', refreshToken)
    this.token = token
    this.refreshToken = refreshToken
  }

})